from django.contrib import admin
from django.urls import path

from app01 import views
from app01.views import XunleiListView
# webapi的内容----------------------------------------------------------------
from django.urls import path, include
from app01.models import UserInfo
from rest_framework import routers, serializers, viewsets


class UserInfoSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = UserInfo
        fields = '__all__'


class UserInfoViewSet(viewsets.ModelViewSet):
    queryset = UserInfo.objects.all()
    serializer_class = UserInfoSerializer


router = routers.DefaultRouter()
router.register(r'usersinfo', UserInfoViewSet)
# webapi的内容----------------------------------------------------------------
urlpatterns = [

    # 测试访问这些都要加app01 例如:http://127.0.0.1:8001/app01/get_system_status/
    path('', include(router.urls)),
    path('api-auth/', include('rest_framework.urls', namespace='rest_framework')),
    # path('admin/', admin.site.urls),
    path('user/', views.user),
    path('post2/', views.post2),
    # path('spider/', views.spider),
    # path('demo/', views.demo),
    # path('test/', views.test),
    path('xunlei_link', XunleiListView.as_view(), name='xunlei_link'),
    path('xunlei_input', XunleiListView.as_view(), name='xunlei_input'),
    path('test/', views.index),
    path('get_system_status/', views.get_system_status),
    # path('app01', JwtTestView.as_view(), name='app01'),  # jwt测试
]
